<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>醋醋商城</title>
    <!--引用css样式-->
    <link rel="shortcut icon" href="/static/favicon.ico">
    <!--<link type="text/css" rel="stylesheet" href="/static/css/bootstrap.css">-->
    <link type="text/css" rel="stylesheet" href="/static/css/basic.css">
    <link type="text/css" rel="stylesheet" href="/static/css/bootstrap.css">
    <title>个人中心</title>
</head>

<style>
    body {
        background: url("/static/images/login_bg.jpg") center top no-repeat;
        background-size: 100% 100%;
    }

    #Top{
        margin-bottom: 150px;
    }

    .container{
        margin-bottom: 300px;
    }
</style>
<body>


<!--Top开始-->
<div id="Top">
    <div class="banner"><a href="/index"><img src="/static/images/logo.png"/></a></div>
    <!--search begin-->
</div>
<!--Top结束-->
<div class="container">

    <div class="panel panel-default">
        <div class="panel-heading">当前个人用户信息</div>
        <div class="panel-body">

            <div class="alert alert-danger" role="alert" th:if="${#httpServletRequest.getAttribute('updateMsg')}">
                <span th:text="${#httpServletRequest.getAttribute('updateMsg')}">

                </span>
            </div>

            <div class="alert alert-success" role="alert" th:if="${#httpServletRequest.getAttribute('successMsg')}">
                <span th:text="${#httpServletRequest.getAttribute('successMsg')}">

                </span>
            </div>

            <form action="/user/profile" method="post" id="do_profile">
                <div class="form-group">
                    <label for="username">用户名</label>
                    <input type="email" class="form-control" name="username" id="username" placeholder="Username"
                           th:value="${#httpServletRequest.getAttribute('userprofile').username}"
                           readonly>
                </div>

                <div class="form-group">
                    <label for="email">Email address</label>
                    <input type="email" class="form-control" name="email" id="email" placeholder="Email"
                           th:value="${#httpServletRequest.getAttribute('userprofile').email}">
                </div>

                <div class="form-group" style="display: none">
                    <label for="id">Email address</label>
                    <input type="email" class="form-control" name="id" id="id"
                           th:value="${#httpServletRequest.getAttribute('userprofile').id}">
                </div>

                <div class="form-group">
                    <label for="password">Password</label>
                    <input type="password" class="form-control" name="password" id="password" placeholder="Password"
                           th:value="${#httpServletRequest.getAttribute('userprofile').password}">
                </div>
            </form>

            <button id="submit" class="btn btn-info">确认修改</button>
        </div>
    </div>
</div>


</body>
<script src="/static/js/jquery.js"></script>
<script>
    $(function () {
        var btn = $('#submit');

        btn.click(function () {
            var password = $('#password').val();
            if (password === "") {
                alert('密码不能为空！')
                return;
            }

            //确认提交？
            var confirm = window.confirm('确认提交?')
            if (confirm) {
                $('#do_profile').submit();
            }

        })


    })
</script>

</html>